<?php

namespace app\common\model;

use think\Model;

class Cart extends Model
{
    protected $name = 'cart';

    // 关联商品
    public function goods()
    {
        return $this->belongsTo('Goods', 'goods_id')
            ->field('id,title,cover_image,status,freight_price,deletetime');
    }

    // 关联规格
    public function spec()
    {
        return $this->belongsTo('GoodsSpec', 'spec_id')
            ->field('id,spec_name,price,original_price,stock,sales');
    }
}